<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=edge, Chrome=1">
  <meta name="renderer" content="webkit">
  <title>JDoc</title>
  <style>
    body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,
    fieldset,input,textarea,p,blockquote,th,td {margin: 0; padding: 0;}
    body {color: #666; font-size: 14px; background-color: #e4e5e6; font-family: 微软雅黑, Arial, 宋体;}
    ol, ul { list-style: none;}
    :focus { outline: 0;}
    a { text-decoration: none; transition: all 0.5s;}
    img { border: 0;}
    * { box-sizing: border-box;}
    .container-fluid { margin: auto;}
    .container-fluid:after { content: " "; display: table; clear: both;}
    h2 { font-size: 30px; line-height: 1.1;}
    h4 { font-size: 18px; line-height: 1.1; font-weight: 500;}
    header { position: fixed; top: 0; left: 0; width: 100%; height: 56px; z-index: 99999; background-color: #fff; border-bottom: 1px solid #d1d4d7;}

    header .logo { float: left; width: 200px; height: 55px; background-position: center; background-repeat: no-repeat;
      background-image: url();}
    header .headbtn { display: inline-block; width: 50px; height: 55px; line-height: 55px; color: #d1d4d7; font-size: 18px; text-align: center; background-position: center; background-repeat: no-repeat;}
    header .headbtn:hover { color: #1ab394;}
    header .sidebar-toggler { float: left; border-right: 1px solid #d1d4d7; background-image: url();}
    header .sidebar-toggler:hover { background-image: url();}
    header .searchbox { float: left; width: calc(100% - 330px); padding-left: 30px;}
    .form-control { border: 1px solid #e5e6e7; border-radius: 1px; color: inherit; display: block; width: 100%; height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.4286; background-color: #fff;}
    .form-control:focus { border-color: #1ab394;}
    header .form-control { border: 0; height: 55px;}
    header .searchbtn { float: right; padding-right: 30px;}
    header .searchbtn a { background-image: url();}
    .navbar-side { position: fixed; top: 56px; left: 0; z-index: 9999; width: 250px; height: calc(100vh - 56px); color: #fff; overflow: auto; background-color: #2f4050; border-radius: 0; transition: all 0.5s;}
    .nav > li > a { display: block; color: #a7b1c2; font-weight: 600; padding: 14px 20px 14px 25px;}
    .nav > li > a:hover, .nav > li > a:focus { background-color: #293846; color: white;}
    .arrow { float: right; margin-top: 2px; width: 14px; height: 14px; transition: all 0.5s; background-position: center; background-repeat: no-repeat;
      background-image: url();}
    .titleicon { display: inline-block; width: 16px; height: 14px;
      background-image: url();}
    .nav > li.active { border-left: 4px solid #19aa8d; background: #293846;}
    .nav > li.active .arrow { transform: rotate(-90deg);}
    .nav-second-level { display: none;}
    .nav-second-level li a { padding: 7px 15px 7px 52px;}
    .page-wrapper { padding-top: 71px; padding-left: 265px; padding-right: 15px; padding-bottom: 15px; transition: all 0.5s;}
    .pageitem { display: none; transition: all 0.5s;}
    .pagewelcom { transition: all 0.5s; min-height: calc(100vh - 86px);}
    .info { padding-top: 65px; padding-left: 50px;}
    .pageitem .commet, .pageitem .return, .pagewelcom { padding: 10px; background-color: #fff;}
    .page-wrapper h2 { padding: 10px; color: #333; font-weight: 600;}
    .pageitem .commet > p { padding: 10px;}
    .table { width: 100%; max-width: 100%; margin-bottom: 20px; border-spacing: 0; border-collapse: collapse; background-color: transparent;}
    .table th, .table td { padding: 8px; text-align: left; line-height: 1.42857143; vertical-align: top; border-top: 1px solid #ddd;}
    .reception .table { border-bottom: solid 1px #ddd;}
    .pageitem .form { padding-top: 15px; padding-right: 45px; padding-bottom: 15px;}
    .form-group { overflow: hidden; margin-bottom: 15px;}
    .control-label { float: left; width: 16.66666667%; padding-top: 7px; margin-bottom: 0; text-align: right; font-weight: 700; padding-right: 15px;}
    .inputbox { margin-left: 16.66666667%; padding-left: 15px; padding-right: 15px;}
    .radio-inline { position: relative; display: inline-block; padding-left: 20px; padding-top: 7px; font-weight: 400; vertical-align: middle; font-weight: 700;}
    .radio-inline label { cursor: pointer;}
    .btn { display: inline-block; padding: 6px 12px; margin-bottom: 0; font-size: 14px; font-weight: 400; line-height: 1.42857143; text-align: center; white-space: nowrap; vertical-align: middle; cursor: pointer; background-color: #ddd; border: 1px solid transparent; border-radius: 4px;}
    .btn:hover { color: #333; background-color: #ccc;}
    .btn-primary { color: #fff; background-color: #337ab7; border-color: #2e6da4;}
    .btn-primary:hover { color: #fff; background-color: #286090; border-color: #204d74;}
    .form-content { padding: 10px;}
    .sidebarhidden .navbar { margin-left: -250px;}
    .sidebarhidden .page-wrapper { padding-left: 15px;}
    .codepanel { padding: 15px; color: #333; background-color: #f6f6f6; border-radius: 3px;}
    .codespaces { display: inline-block; width: 20px; height: 16px; vertical-align: middle;}
    .codekey { color: #8757bd;}
    .codeval { color: #ea854e;}
  </style>
</head>

<body>
  <div class="container-fluid">
    <header>
      <a href="#" class="logo"></a>
      <a href="javascript:" class="headbtn sidebar-toggler" onclick="sidebarToggle();"></a>
      <div class="searchbox">
        <input type="text" placeholder="请输入搜索内容..." autocomplete="off" class="form-control" id="searchinput">
      </div>
      <div class="searchbtn">
        <a href="javascript:" class="headbtn"></a>
      </div>
    </header>
    <div id="wrapper">
    </div>
  </div>

  <!-- 模板 -->
  <script id="sidenav-temp" type="text/html">
    <nav class="navbar navbar-side">
      <ul class="nav">
        {{each}}
        <li>
          <a href="javascript:">
            <i class="titleicon"></i>
            <span class="nav-label">{{$value.title}}</span>
            <span class="arrow"></span>
          </a>
          {{if $value.apiActions}}
          <ul class="nav nav-second-level">
            {{each $value.apiActions}}
            <li>
              <a href="javascript:" class="listitem">{{$value.title}}</a>
            </li>
            {{/each}}
          </ul>
          {{/if}}
        </li>
        {{/each}}
      </ul>
    </nav>
    <div class="page-wrapper row">
      <div class="pagewelcom">
        <h2>欢迎使用JDoc</h2>
        <h4 class="info">前端模板作者：周星华（QQ：499244819）</h4>
        <h4 class="info">后端模板作者：梁豪（QQ：451671299）</h4>
        <h4 class="info">QQ交流群：232558246</h4>
       </div>
      {{each}} {{each $value.apiActions}}
      <div class="pageitem">
        <div class="commet">
          <h2>{{$value.title}}</h2>
          <p>{{$value.desc}}</p>
          <p>接口地址: {{$value.url}}</p>
          <p>请求类型: {{$value.requestType}}</p>
          <h2>入参</h2>
          <div class="reception">
            <table class="table">
              <tr>
                <th>参数名</th>
                <th>参数类型</th>
                <th>是否必填</th>
                <th>描述</th>
              </tr>
              {{each $value.reqParams}}
              <tr>
                <td>{{$value.name}}</td>
                <td>{{$value.type}}</td>
                <td>{{$value.required}}</td>
                <td>{{$value.desc}}</td>
              </tr>
              {{/each}}
            </table>
          </div>
          <h2>出参</h2>
          <div class="reception">
            <table class="table">
              <tr>
                <th>参数名</th>
                <th>参数类型</th>
                <th>是否必填</th>
                <th>描述</th>
              </tr>
              {{each $value.respParams}}
              <tr>
                <td>{{$value.name}}</td>
                <td>{{$value.type}}</td>
                <td>{{$value.required}}</td>
                <td>{{$value.desc}}</td>
              </tr>
              {{/each}}
            </table>
          </div>
          <p>返回示例: {{#$value.respText | formatjson}}</p>
        </div>
        <div class="return">
          <h2>测试</h2>
          <div class="form">
            {{each $value.reqParams}}
            <div class="form-group">
              <label class="control-label">{{$value.desc}}</label>
              <div class="inputbox">
                <input type="text" name="{{$value.name}}" class="form-control">
              </div>
            </div>
            {{/each}}
            <div class="form-group">
              <label class="control-label">请求方式</label>
              <div class="inputbox">
                <div class="radio-inline">
                  <label>
                    <input type="radio" checked="checked" value="post" name="type-{{$value.url}}"> post
                  </label>
                </div>
                <div class="radio-inline">
                  <label>
                    <input type="radio" value="get" name="type-{{$value.url}}"> get
                  </label>
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="form-btn inputbox">
                <button class="btn btn-primary" data-url="{{$value.url}}" onclick="testSend(this);">测试</button>
                <button class="btn" onclick="reset(this);">重置</button>
              </div>
            </div>
          </div>
          <h2>返回内容</h2>
          <div class="form-content">

          </div>
        </div>
      </div>
      {{/each}} {{/each}}
    </div>
  </script>

  <!-- 全局js -->
  <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
  <script>
/*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
!function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;e.openTag="{{",e.closeTag="}}";var z=function(a,b){var c=b.split(":"),d=c.shift(),e=c.join(":")||"";return e&&(e=", "+e),"$helpers."+d+"("+a+e+")"};e.parser=function(a,b){a=a.replace(/^\s/,"");var c=a.split(" "),e=c.shift(),f=c.join(" ");switch(e){case"if":a="if("+f+"){";break;case"else":c="if"===c.shift()?" if("+c.join(" ")+")":"",a="}else"+c+"{";break;case"/if":a="}";break;case"each":var g=c[0]||"$data",h=c[1]||"as",i=c[2]||"$value",j=c[3]||"$index",k=i+","+j;"as"!==h&&(g="[]"),a="$each("+g+",function("+k+"){";break;case"/each":a="});";break;case"echo":a="print("+f+");";break;case"print":case"include":a=e+"("+c.join(",")+");";break;default:if(/^\s*\|\s*[\w\$]/.test(f)){var l=!0;0===a.indexOf("#")&&(a=a.substr(1),l=!1);for(var m=0,n=a.split("|"),o=n.length,p=n[m++];m<o;m++)p=z(p,n[m]);a=(l?"=":"=#")+p}else a=d.helpers[e]?"=#"+e+"("+c.join(",")+");":"="+a}return a},"function"==typeof define?define(function(){return d}):"undefined"!=typeof exports?module.exports=d:this.template=d}();
  </script>

  <script>
    var Jdata =[{"apiActions":[{"desc":"用于添加用户功能","reqParams":[{"desc":"用户名","name":"username","required":"必填","type":"String"},{"desc":"密码","name":"password","required":"必填","type":"String"}],"requestType":"post","respParams":[],"respText":"{\"code\":\"100000\",\"data\":\"\",\"message\":\"新增成功\"}","title":"新增用户","url":"/user/add"},{"desc":"用于删除用户功能","reqParams":[{"desc":"用户id","name":"id","required":"必填","type":"Intger"}],"requestType":"post,get","respParams":[],"respText":"{\"code\":\"100000\",\"data\":\"\",\"message\":\"新增成功\"}","title":"删除用户","url":"/user/delete"},{"desc":"通过用户id查询用户功能","reqParams":[],"requestType":"post,get","respParams":[{"desc":"用户名","name":"username","required":"必填","type":"String"},{"desc":"密码","name":"password","required":"必填","type":"String"}],"respText":"{\"code\":\"100000\",\"data\":{\"password\":\"123456\",\"username\":\"13811111111\"},\"message\":\"删除成功\"}","title":"查询ID查用户","url":"/user/getUserById"}],"title":"用户模块"}];
    
    $(document).ready(function () {
      
      template.helper("formatjson", function (data) {
        return formatJson(data);
      });
      var navhtml = template("sidenav-temp", Jdata);
      $("#wrapper").html(navhtml);

      $("#wrapper").on("click", ".navbar-side li > a", function () {
        if ($(this).hasClass("listitem")) {
          var index = $("#wrapper .listitem").index(this);
          $(".page-wrapper .pageitem").eq(index).show().siblings().hide();
        } else {
          $(this).siblings("ul").slideToggle().parent("li").toggleClass("active")
                 .siblings().removeClass("active").find("ul").slideUp();
        }
      });
      
      $("#searchinput").on("keyup paste", function () {
        var txt = $(this).val();
        $(".nav li").hide();
        var list = [];
        $("#wrapper .listitem").each(function (index) {
          var title = $(this).text();
          if (title.indexOf(txt) > -1) {
            list.push(index);
          }
        });
        $.each(list, function (index, value) {
          $("#wrapper .listitem").eq(value).show().parents("li").show();
        });
        var minIndex = Math.min.apply(null, list);
        $("#wrapper .listitem").eq(minIndex).parents("ul").show().parents("li").addClass("active");
      });
    });

    function sidebarToggle() {
      $("#wrapper").toggleClass("sidebarhidden");
    }

    function testSend(target) {
      var url = $(target).data("url");
      var dataArray = $(target).parents(".form").find(":input").serializeArray();
      var d = {},
        type = "post";
      $.each(dataArray, function (key, value) {
        var dataName = value.name;
        var dataValue = value.value;
        if (dataName.indexOf("sendType") < 0) {
          d[dataName] = dataValue;
        } else {
          type = dataValue;
        }
      });
      
      $.ajax({
        url: url,
        type: type,
        data: d,
        dataType: "json",
        success: function (data) {
          var jsonhtml = formatJson(data);
          $(target).parents(".form").siblings(".form-content").html(jsonhtml);
        }
      });
    }
    function reset(target) {
      $(target).parents(".form").find(".form-control").val("");
      $(target).parents(".form").find("input[type=radio][value='post']").prop("checked", true);
    }

    function formatJson(json) {
      var reg = null,
        formatted = "<div class=\"codepanel\">",
        pad = 0,
        PADDING = "<span class=\"codespaces\"></span>";
      if (typeof json !== "string") {
        json = JSON.stringify(json);
      } else {
        json = eval('(' + json + ')');
        json = JSON.stringify(json);
      }
      reg = /(\{)/g;
      json = json.replace(reg, "$1\r\n");
      reg = /(\})/g;
      json = json.replace(reg, "\r\n$1\r\n");
      reg = /(\,)/g;
      json = json.replace(reg, "$1\r\n");
      reg = /\r\n\r\n/g;
      json = json.replace(reg, "\r\n");
      reg = /\r\n\,/g;
      json = json.replace(reg, ",");
      reg = /\,\r\n\{/g;
      json = json.replace(reg, ",&nbsp;{");
      reg = /\:/g;
      json = json.replace(reg, ":&nbsp;");
      reg = /\:&nbsp;\r\n\{/g;
      json = json.replace(reg, ":&nbsp;{");
      reg = /\:&nbsp;\r\n\[/g;
      json = json.replace(reg, ":&nbsp;[");
      reg = /\}\r\n\]/g;
      json = json.replace(reg, "}]");
      reg = /\}\r\n\"/g;
      json = json.replace(reg, "}\"");
      reg = /\]\r\n\"/g;
      json = json.replace(reg, "]\"");

      $.each(json.split("\r\n"), function (index, node) {
        var i = 0,
          indent = 0,
          padding = "";
        if (node.match(/^\}\,&nbsp;\{$/)) {
          if (pad !== 0) {
            pad--;
          }
          indent = 1;
        } else if (node.match(/\{$/)) {
          indent = 1;
        } else if (node.match(/\}/)) {
          if (pad !== 0) {
            pad--;
          }
        } else {
          indent = 0;
        }

        for (i = 0; i < pad; i++) {
          padding += PADDING;
        }
        var subcode = node.split(":");
        var codekey = "";
        if (subcode[0].match(/[\{\[]$/) || subcode[0].match(/^[\}\]]/)) {
          codekey += subcode[0];
        } else {
          codekey += "<span class=\"codekey\">" + subcode[0] + "</span>";
        }
        if (subcode[1]) {
          if (subcode[1].match(/\{$/) || subcode[1].match(/\[$/)) {
            codekey += ":" + subcode[1];
          } else {
            codekey += ":<span class=\"codeval\">" + subcode[1] + "</span>";
          }
        }

        formatted += "<p>" + padding + codekey + "</p>";
        pad += indent;
      });
      formatted += "</div>";
      return formatted;
    };
  </script>

</body>

</html>